package com.scpii.universal.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.scpii.universal.hibernate.dao.BaseDao;
import com.scpii.universal.hibernate.entity.UserWeiboTab;
import com.scpii.universal.hibernate.intface.BaseInterface;
import com.scpii.universal.util.SpringBeanFactory;

public class UserWeiboTabService implements BaseInterface<UserWeiboTab> {
	private static final Logger log = LoggerFactory
			.getLogger(UserWeiboTabService.class);
//	private BaseDao<UserWeiboTab> userWeiboTabDao = SpringBeanFactory.userWeiboTabDao;
	private BaseDao<UserWeiboTab> userWeiboTabDao;
	
	public UserWeiboTab get(Integer id) throws Exception {
		return userWeiboTabDao.get(id);
	}

	public List<UserWeiboTab> getAll() throws Exception {
		return userWeiboTabDao.getAll();
	}

	public UserWeiboTab get(String propertyName, Object value) throws Exception {
		return null;
	}

	public List<UserWeiboTab> getList(String propertyName, Object value)
			throws Exception {
		return null;
	}

	public Long getTotalCount() throws Exception {
		return null;
	}

	public void save(UserWeiboTab obj) throws Exception {

	}

	public void update(UserWeiboTab obj) throws Exception {

	}

	public void delete(UserWeiboTab obj) throws Exception {

	}

	public void delete(Integer id) throws Exception {

	}

	public List<UserWeiboTab> hqlGetList(String hql, Map<String, Object> argsMap)
			throws Exception {
		return userWeiboTabDao.hqlGetList(hql, argsMap);
	}

	public void hqlUpdate(String namedHqlQuery, Map<String, Object> argsMap)
			throws Exception {
		userWeiboTabDao.hqlUpdate(namedHqlQuery, argsMap);
	}

	public Long hqlGetNums(String namedHqlQuery, Map<String, Object> argsMap)
			throws Exception {
		return userWeiboTabDao.hqlGetNums(namedHqlQuery, argsMap);
	}

	public List<UserWeiboTab> sqlGetList(String sqls, Map<String, Object> argsMap)
			throws Exception {
		return userWeiboTabDao.sqlGetList(sqls, argsMap);
	}

	public void sqlUpdate(String sqls, Map<String, Object> argsMap)
			throws Exception {
		userWeiboTabDao.sqlUpdate(sqls, argsMap);
	}

	public Long sqlGetNum(String sqls, Map<String, Object> argsMap)
			throws Exception {
		return userWeiboTabDao.sqlGetNum(sqls, argsMap);
	}
	
	/**
	 * 获得应用的绑定的企业微博账号信息
	 * @param appId
	 * @return
	 * @throws Exception
	 * @author 甘建新
	 * 2012-7-24上午12:49:38
	 */
	public UserWeiboTab getEnterpWeibo(int appId)throws Exception{
		if (appId>0) {
			Map<String, Object> argsMap = new HashMap<String, Object>();
			argsMap.put("appId", appId);
			List<UserWeiboTab> weiboList = this.hqlGetList("GET_ENTERP_WEIBO_BYAPPID", argsMap);
			if (weiboList!=null && weiboList.size()==1) {
				return weiboList.get(0);
			}
		}
		return null;
	}

	//Setter
	public void setUserWeiboTabDao(BaseDao<UserWeiboTab> userWeiboTabDao) {
		this.userWeiboTabDao = userWeiboTabDao;
	}
	
	
}